const express = require('express')
const {queryDBPromise} = require('../db/utildb')
const categoryRouter = express() // 路由对象

/**
 * 商品分类列表
 *   method:GET
 *   url: /categorys
 */
categoryRouter.get('/categorys',(req,res)=>{
    const sql = 'SELECT id,name,url FROM category'
    queryDBPromise(sql).then(data=>{
        res.send({
            code:1,
            list:data
        })
    })
})

module.exports = {categoryRouter}
